﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace Maticsoft.DAL
{
	/// <summary>
	/// 数据访问类:supplyPlan
	/// </summary>
	public partial class supplyPlan
	{
		public supplyPlan()
		{}
        public int GetRecordSumPrice(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT convert(int,sum(num*unitPrice)) AS pronum FROM dbo.supplyPlan INNER JOIN dbo.project ON dbo.supplyPlan.projectId = dbo.project.projectId ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where 1=1 and" + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        public int GetRecordOverSumPrice(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT convert(int,sum(num*unitPrice)) AS proovernum FROM         dbo.monthSupplayPlan INNER JOIN dbo.supplyPlan ON dbo.monthSupplayPlan.supplyPlanId = dbo.supplyPlan.supplyPlanId INNER JOIN dbo.project ON dbo.supplyPlan.projectId = dbo.project.projectId WHERE(dbo.monthSupplayPlan.result = '已完成')");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" and " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        public int GetRecordSum(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT     COUNT(supplyPlanId) AS pronum FROM dbo.supplyPlan INNER JOIN dbo.project ON dbo.supplyPlan.projectId = dbo.project.projectId ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where 1=1 and" + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        public int GetRecordOverSum(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT COUNT(DISTINCT dbo.monthSupplayPlan.supplyPlanId) AS proovernum FROM         dbo.monthSupplayPlan INNER JOIN dbo.supplyPlan ON dbo.monthSupplayPlan.supplyPlanId = dbo.supplyPlan.supplyPlanId INNER JOIN dbo.project ON dbo.supplyPlan.projectId = dbo.project.projectId WHERE(dbo.monthSupplayPlan.result = '已完成')");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" and "+strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        //计划拍照用
        public int GetRecordCountMap(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM Vmobilesupply ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where 1=1 " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPageMap(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.supplyPlanId desc");
            }
            strSql.Append(")AS Row, T.*  from Vmobilesupply T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE 1=1 " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }
        /// <summary>
        /// 更新Remark
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateRemark(int id,string remark)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update supplyPlan set ");            
            strSql.Append("remark=@remark ");            
            strSql.Append(" where supplyPlanId=@supplyPlanId");
            SqlParameter[] parameters = {					
					new SqlParameter("@remark", SqlDbType.NVarChar,500),					
					new SqlParameter("@supplyPlanId", SqlDbType.Int,4)};
            parameters[0].Value = remark;
            parameters[1].Value = id;           

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 获取供应计划入库总数列表
        /// </summary>
        /// 
        public DataSet GetListnumsbyid(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [projectId],[material],[num],[aognums],[pinums],[innums],[nums],thisMonthCount,[ddate],[lastArrivalDate],[lastCheckedDate],[lastInstoreDate],[supplyDate],supplyPDate,outnums,lastouttime,purchaseid FROM [Vtimelinenums]");
            strSql.Append(" where 1=1" + strWhere);            
            return DbHelperSQL.Query(strSql.ToString());
        }
        public DataSet GetListSumInnumsInfo(int user_id,DateTime monthEndTime,string material,
            string projectName, string sname, string ghqStart,string ghqEnd,string isMonthSupplyPlan, int currentPageIndex, int pageSize, out int count)
        {
            DateTime ghqStartTime = DateTime.Parse("2000-01-01 00:00:00");
            if (!string.IsNullOrEmpty(ghqStart))
            {
                ghqStartTime = DateTime.Parse(ghqStart);
            }

            DateTime ghqEndTime = DateTime.Parse("2090-01-01 00:00:00");
            if (!string.IsNullOrEmpty(ghqEnd))
            {
                ghqEndTime = DateTime.Parse(ghqEnd);
            }


            SqlParameter[] para = 
            {
                new SqlParameter("@currentPageIndex",SqlDbType.Int),
                new SqlParameter("@pageSize",SqlDbType.Int),
                new SqlParameter("@count",SqlDbType.Int),
                new SqlParameter("@monthEndTime",SqlDbType.DateTime),
                new SqlParameter("@user_id",SqlDbType.Int),
                new SqlParameter("@material",SqlDbType.VarChar,200),
                new SqlParameter("@projectName",SqlDbType.VarChar,100),
                new SqlParameter("@sname",SqlDbType.VarChar,100),
                new SqlParameter("@ghqStart",SqlDbType.DateTime),
                new SqlParameter("@ghqEnd",SqlDbType.DateTime),
                new SqlParameter("@isMonthSupplyPlan",SqlDbType.VarChar,6)
            };

            para[0].Value = currentPageIndex;
            para[1].Value = pageSize;
            para[2].Direction = ParameterDirection.Output;
            para[3].Value = monthEndTime;
            para[4].Value = user_id;
            para[5].Value = material;
            para[6].Value = projectName;
            para[7].Value = sname;
            para[8].Value = ghqStartTime;
            para[9].Value = ghqEndTime;
            para[10].Value = isMonthSupplyPlan;


            DataSet ds = DbHelperSQL.RunProcedure("P_GetSupplyPlanSumNumsInfo", para, "ds");

            if (!Convert.IsDBNull(para[2].Value))
            {
                count = Convert.ToInt32(para[2].Value);
            }
            else
            {
                count = 0;
            }

            return ds;
        }

        public DataSet GetListSumInnumsInfo(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" select * from VsupplyPlanSumNumsInfo  ");

            //strSql.Append(" select * from VsupplyPlanSumNumsInfo  ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }

            strSql.Append( " order by supplyDate desc ");
            return DbHelperSQL.Query(strSql.ToString());
        }
        /// <summary>
        /// 获取数据列表，包含当月计划的配送入库量(innums)、初验量(pinnums)和到货数量(aognums)
        /// 注意出现"null"值现象
        /// </summary>
        public DataSet GetListInnum(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from VsupplyPlanAllNums ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }
        /// <summary>
        /// 获取计划入库量(innums)
        /// </summary>
        public DataSet GetListAllInums(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  sum((case when innums is null then 0 else innums end)) as innums  from VsupplyPlanAllNums ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" group by supplyPlanId ");
            return DbHelperSQL.Query(strSql.ToString());
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM VsupplyPlanPro ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by importTime desc ");
            return DbHelperSQL.Query(strSql.ToString());
        }

        #region  Method

        /// <summary>
        /// 得到最大ID
        /// </summary>
        public int GetMaxId()
        {
            return DbHelperSQL.GetMaxID("supplyPlanId", "supplyPlan");
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int supplyPlanId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from supplyPlan");
            strSql.Append(" where supplyPlanId=@supplyPlanId");
            SqlParameter[] parameters = {
					new SqlParameter("@supplyPlanId", SqlDbType.Int,4)
			};
            parameters[0].Value = supplyPlanId;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.supplyPlan model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into supplyPlan(");
            strSql.Append("purchaseid,proid,projectId,bidid,usework,supplyDate,mbm,material,num,unit,unitPrice,technicalDataStatus,technicalDataStatusDate,supplyDateStatus,supplyDateStatusDate,arrivalCount,contractdate,complateDate,fristCheckedCount,instoreCount,arrivalBillStatus,arrivalEvaluationStatus,arrivalEvaluationStatusDate,outstoreCount,installationStatus,installationStatusDate,putOperationStatus,putOperationStatusDate,putOperationEvaluationStaus,putOperationEvaluationStausDate,warrantyStatus,warrantyStatusDate,winBid,warrantyEvaluationStaus,warrantyEvaluationStausDate,sourceProid,sourceProjectId,sourceProjectName,equipmentManage,sid,sname,slink,slinkContent,confirmDateWarn,wasteCount,realSupplyDate,warrantyTime,settlementTimeWarn,coordinate,deviceproductionstate,remark,user_id,supplyPlanType,isEarly,importTime)");
            strSql.Append(" values (");
            strSql.Append("@purchaseid,@proid,@projectId,@bidid,@usework,@supplyDate,@mbm,@material,@num,@unit,@unitPrice,@technicalDataStatus,@technicalDataStatusDate,@supplyDateStatus,@supplyDateStatusDate,@arrivalCount,@contractdate,@complateDate,@fristCheckedCount,@instoreCount,@arrivalBillStatus,@arrivalEvaluationStatus,@arrivalEvaluationStatusDate,@outstoreCount,@installationStatus,@installationStatusDate,@putOperationStatus,@putOperationStatusDate,@putOperationEvaluationStaus,@putOperationEvaluationStausDate,@warrantyStatus,@warrantyStatusDate,@winBid,@warrantyEvaluationStaus,@warrantyEvaluationStausDate,@sourceProid,@sourceProjectId,@sourceProjectName,@equipmentManage,@sid,@sname,@slink,@slinkContent,@confirmDateWarn,@wasteCount,@realSupplyDate,@warrantyTime,@settlementTimeWarn,@coordinate,@deviceproductionstate,@remark,@user_id,@supplyPlanType,@isEarly,@importTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@purchaseid", SqlDbType.VarChar,50),
					new SqlParameter("@proid", SqlDbType.NVarChar,50),
					new SqlParameter("@projectId", SqlDbType.Int,4),
					new SqlParameter("@bidid", SqlDbType.VarChar,50),
					new SqlParameter("@usework", SqlDbType.VarChar,50),
					new SqlParameter("@supplyDate", SqlDbType.DateTime),
					new SqlParameter("@mbm", SqlDbType.NVarChar,50),
					new SqlParameter("@material", SqlDbType.NVarChar,250),
					new SqlParameter("@num", SqlDbType.Decimal,9),
					new SqlParameter("@unit", SqlDbType.NChar,10),
					new SqlParameter("@unitPrice", SqlDbType.Money,8),
					new SqlParameter("@technicalDataStatus", SqlDbType.VarChar,10),
					new SqlParameter("@technicalDataStatusDate", SqlDbType.DateTime),
					new SqlParameter("@supplyDateStatus", SqlDbType.VarChar,10),
					new SqlParameter("@supplyDateStatusDate", SqlDbType.DateTime),
					new SqlParameter("@arrivalCount", SqlDbType.Decimal,9),
					new SqlParameter("@contractdate", SqlDbType.DateTime),
					new SqlParameter("@complateDate", SqlDbType.DateTime),
					new SqlParameter("@fristCheckedCount", SqlDbType.Decimal,9),
					new SqlParameter("@instoreCount", SqlDbType.Decimal,9),
					new SqlParameter("@arrivalBillStatus", SqlDbType.VarChar,50),
					new SqlParameter("@arrivalEvaluationStatus", SqlDbType.VarChar,10),
					new SqlParameter("@arrivalEvaluationStatusDate", SqlDbType.DateTime),
					new SqlParameter("@outstoreCount", SqlDbType.Decimal,9),
					new SqlParameter("@installationStatus", SqlDbType.VarChar,10),
					new SqlParameter("@installationStatusDate", SqlDbType.DateTime),
					new SqlParameter("@putOperationStatus", SqlDbType.VarChar,10),
					new SqlParameter("@putOperationStatusDate", SqlDbType.DateTime),
					new SqlParameter("@putOperationEvaluationStaus", SqlDbType.VarChar,10),
					new SqlParameter("@putOperationEvaluationStausDate", SqlDbType.DateTime),
					new SqlParameter("@warrantyStatus", SqlDbType.VarChar,10),
					new SqlParameter("@warrantyStatusDate", SqlDbType.DateTime),
					new SqlParameter("@winBid", SqlDbType.VarChar,30),
					new SqlParameter("@warrantyEvaluationStaus", SqlDbType.VarChar,10),
					new SqlParameter("@warrantyEvaluationStausDate", SqlDbType.DateTime),
					new SqlParameter("@sourceProid", SqlDbType.NVarChar,50),
					new SqlParameter("@sourceProjectId", SqlDbType.Int,4),
					new SqlParameter("@sourceProjectName", SqlDbType.VarChar,50),
					new SqlParameter("@equipmentManage", SqlDbType.VarChar,50),
					new SqlParameter("@sid", SqlDbType.Int,4),
					new SqlParameter("@sname", SqlDbType.VarChar,50),
					new SqlParameter("@slink", SqlDbType.NVarChar,50),
					new SqlParameter("@slinkContent", SqlDbType.VarChar,50),
					new SqlParameter("@confirmDateWarn", SqlDbType.VarChar,30),
					new SqlParameter("@wasteCount", SqlDbType.Decimal,9),
					new SqlParameter("@realSupplyDate", SqlDbType.DateTime),
					new SqlParameter("@warrantyTime", SqlDbType.VarChar,10),
					new SqlParameter("@settlementTimeWarn", SqlDbType.VarChar,10),
					new SqlParameter("@coordinate", SqlDbType.VarChar,50),
					new SqlParameter("@deviceproductionstate", SqlDbType.VarChar,50),
					new SqlParameter("@remark", SqlDbType.NVarChar,500),
					new SqlParameter("@user_id", SqlDbType.Int,4),
					new SqlParameter("@supplyPlanType", SqlDbType.VarChar,20),
					new SqlParameter("@isEarly", SqlDbType.Bit,1),
					new SqlParameter("@importTime", SqlDbType.DateTime)};
            parameters[0].Value = model.purchaseid;
            parameters[1].Value = model.proid;
            parameters[2].Value = model.projectId;
            parameters[3].Value = model.bidid;
            parameters[4].Value = model.usework;
            parameters[5].Value = model.supplyDate;
            parameters[6].Value = model.mbm;
            parameters[7].Value = model.material;
            parameters[8].Value = model.num;
            parameters[9].Value = model.unit;
            parameters[10].Value = model.unitPrice;
            parameters[11].Value = model.technicalDataStatus;
            parameters[12].Value = model.technicalDataStatusDate;
            parameters[13].Value = model.supplyDateStatus;
            parameters[14].Value = model.supplyDateStatusDate;
            parameters[15].Value = model.arrivalCount;
            parameters[16].Value = model.contractdate;
            parameters[17].Value = model.complateDate;
            parameters[18].Value = model.fristCheckedCount;
            parameters[19].Value = model.instoreCount;
            parameters[20].Value = model.arrivalBillStatus;
            parameters[21].Value = model.arrivalEvaluationStatus;
            parameters[22].Value = model.arrivalEvaluationStatusDate;
            parameters[23].Value = model.outstoreCount;
            parameters[24].Value = model.installationStatus;
            parameters[25].Value = model.installationStatusDate;
            parameters[26].Value = model.putOperationStatus;
            parameters[27].Value = model.putOperationStatusDate;
            parameters[28].Value = model.putOperationEvaluationStaus;
            parameters[29].Value = model.putOperationEvaluationStausDate;
            parameters[30].Value = model.warrantyStatus;
            parameters[31].Value = model.warrantyStatusDate;
            parameters[32].Value = model.winBid;
            parameters[33].Value = model.warrantyEvaluationStaus;
            parameters[34].Value = model.warrantyEvaluationStausDate;
            parameters[35].Value = model.sourceProid;
            parameters[36].Value = model.sourceProjectId;
            parameters[37].Value = model.sourceProjectName;
            parameters[38].Value = model.equipmentManage;
            parameters[39].Value = model.sid;
            parameters[40].Value = model.sname;
            parameters[41].Value = model.slink;
            parameters[42].Value = model.slinkContent;
            parameters[43].Value = model.confirmDateWarn;
            parameters[44].Value = model.wasteCount;
            parameters[45].Value = model.realSupplyDate;
            parameters[46].Value = model.warrantyTime;
            parameters[47].Value = model.settlementTimeWarn;
            parameters[48].Value = model.coordinate;
            parameters[49].Value = model.deviceproductionstate;
            parameters[50].Value = model.remark;
            parameters[51].Value = model.user_id;
            parameters[52].Value = model.supplyPlanType;
            parameters[53].Value = model.isEarly;
            parameters[54].Value = model.importTime;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.supplyPlan model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update supplyPlan set ");
            strSql.Append("purchaseid=@purchaseid,");
            strSql.Append("proid=@proid,");
            strSql.Append("projectId=@projectId,");
            strSql.Append("bidid=@bidid,");
            strSql.Append("usework=@usework,");
            strSql.Append("supplyDate=@supplyDate,");
            strSql.Append("mbm=@mbm,");
            strSql.Append("material=@material,");
            strSql.Append("num=@num,");
            strSql.Append("unit=@unit,");
            strSql.Append("unitPrice=@unitPrice,");
            strSql.Append("technicalDataStatus=@technicalDataStatus,");
            strSql.Append("technicalDataStatusDate=@technicalDataStatusDate,");
            strSql.Append("supplyDateStatus=@supplyDateStatus,");
            strSql.Append("supplyDateStatusDate=@supplyDateStatusDate,");
            strSql.Append("arrivalCount=@arrivalCount,");
            strSql.Append("contractdate=@contractdate,");
            strSql.Append("complateDate=@complateDate,");
            strSql.Append("fristCheckedCount=@fristCheckedCount,");
            strSql.Append("instoreCount=@instoreCount,");
            strSql.Append("arrivalBillStatus=@arrivalBillStatus,");
            strSql.Append("arrivalEvaluationStatus=@arrivalEvaluationStatus,");
            strSql.Append("arrivalEvaluationStatusDate=@arrivalEvaluationStatusDate,");
            strSql.Append("outstoreCount=@outstoreCount,");
            strSql.Append("installationStatus=@installationStatus,");
            strSql.Append("installationStatusDate=@installationStatusDate,");
            strSql.Append("putOperationStatus=@putOperationStatus,");
            strSql.Append("putOperationStatusDate=@putOperationStatusDate,");
            strSql.Append("putOperationEvaluationStaus=@putOperationEvaluationStaus,");
            strSql.Append("putOperationEvaluationStausDate=@putOperationEvaluationStausDate,");
            strSql.Append("warrantyStatus=@warrantyStatus,");
            strSql.Append("warrantyStatusDate=@warrantyStatusDate,");
            strSql.Append("winBid=@winBid,");
            strSql.Append("warrantyEvaluationStaus=@warrantyEvaluationStaus,");
            strSql.Append("warrantyEvaluationStausDate=@warrantyEvaluationStausDate,");
            strSql.Append("sourceProid=@sourceProid,");
            strSql.Append("sourceProjectId=@sourceProjectId,");
            strSql.Append("sourceProjectName=@sourceProjectName,");
            strSql.Append("equipmentManage=@equipmentManage,");
            strSql.Append("sid=@sid,");
            strSql.Append("sname=@sname,");
            strSql.Append("slink=@slink,");
            strSql.Append("slinkContent=@slinkContent,");
            strSql.Append("confirmDateWarn=@confirmDateWarn,");
            strSql.Append("wasteCount=@wasteCount,");
            strSql.Append("realSupplyDate=@realSupplyDate,");
            strSql.Append("warrantyTime=@warrantyTime,");
            strSql.Append("settlementTimeWarn=@settlementTimeWarn,");
            strSql.Append("coordinate=@coordinate,");
            strSql.Append("deviceproductionstate=@deviceproductionstate,");
            strSql.Append("remark=@remark,");
            strSql.Append("user_id=@user_id,");
            strSql.Append("supplyPlanType=@supplyPlanType,");
            strSql.Append("isEarly=@isEarly,");
            strSql.Append("importTime=@importTime");
            strSql.Append(" where supplyPlanId=@supplyPlanId");
            SqlParameter[] parameters = {
					new SqlParameter("@purchaseid", SqlDbType.VarChar,50),
					new SqlParameter("@proid", SqlDbType.NVarChar,50),
					new SqlParameter("@projectId", SqlDbType.Int,4),
					new SqlParameter("@bidid", SqlDbType.VarChar,50),
					new SqlParameter("@usework", SqlDbType.VarChar,50),
					new SqlParameter("@supplyDate", SqlDbType.DateTime),
					new SqlParameter("@mbm", SqlDbType.NVarChar,50),
					new SqlParameter("@material", SqlDbType.NVarChar,250),
					new SqlParameter("@num", SqlDbType.Decimal,9),
					new SqlParameter("@unit", SqlDbType.NChar,10),
					new SqlParameter("@unitPrice", SqlDbType.Money,8),
					new SqlParameter("@technicalDataStatus", SqlDbType.VarChar,10),
					new SqlParameter("@technicalDataStatusDate", SqlDbType.DateTime),
					new SqlParameter("@supplyDateStatus", SqlDbType.VarChar,10),
					new SqlParameter("@supplyDateStatusDate", SqlDbType.DateTime),
					new SqlParameter("@arrivalCount", SqlDbType.Decimal,9),
					new SqlParameter("@contractdate", SqlDbType.DateTime),
					new SqlParameter("@complateDate", SqlDbType.DateTime),
					new SqlParameter("@fristCheckedCount", SqlDbType.Decimal,9),
					new SqlParameter("@instoreCount", SqlDbType.Decimal,9),
					new SqlParameter("@arrivalBillStatus", SqlDbType.VarChar,50),
					new SqlParameter("@arrivalEvaluationStatus", SqlDbType.VarChar,10),
					new SqlParameter("@arrivalEvaluationStatusDate", SqlDbType.DateTime),
					new SqlParameter("@outstoreCount", SqlDbType.Decimal,9),
					new SqlParameter("@installationStatus", SqlDbType.VarChar,10),
					new SqlParameter("@installationStatusDate", SqlDbType.DateTime),
					new SqlParameter("@putOperationStatus", SqlDbType.VarChar,10),
					new SqlParameter("@putOperationStatusDate", SqlDbType.DateTime),
					new SqlParameter("@putOperationEvaluationStaus", SqlDbType.VarChar,10),
					new SqlParameter("@putOperationEvaluationStausDate", SqlDbType.DateTime),
					new SqlParameter("@warrantyStatus", SqlDbType.VarChar,10),
					new SqlParameter("@warrantyStatusDate", SqlDbType.DateTime),
					new SqlParameter("@winBid", SqlDbType.VarChar,30),
					new SqlParameter("@warrantyEvaluationStaus", SqlDbType.VarChar,10),
					new SqlParameter("@warrantyEvaluationStausDate", SqlDbType.DateTime),
					new SqlParameter("@sourceProid", SqlDbType.NVarChar,50),
					new SqlParameter("@sourceProjectId", SqlDbType.Int,4),
					new SqlParameter("@sourceProjectName", SqlDbType.VarChar,50),
					new SqlParameter("@equipmentManage", SqlDbType.VarChar,50),
					new SqlParameter("@sid", SqlDbType.Int,4),
					new SqlParameter("@sname", SqlDbType.VarChar,50),
					new SqlParameter("@slink", SqlDbType.NVarChar,50),
					new SqlParameter("@slinkContent", SqlDbType.VarChar,50),
					new SqlParameter("@confirmDateWarn", SqlDbType.VarChar,30),
					new SqlParameter("@wasteCount", SqlDbType.Decimal,9),
					new SqlParameter("@realSupplyDate", SqlDbType.DateTime),
					new SqlParameter("@warrantyTime", SqlDbType.VarChar,10),
					new SqlParameter("@settlementTimeWarn", SqlDbType.VarChar,10),
					new SqlParameter("@coordinate", SqlDbType.VarChar,50),
					new SqlParameter("@deviceproductionstate", SqlDbType.VarChar,50),
					new SqlParameter("@remark", SqlDbType.NVarChar,500),
					new SqlParameter("@user_id", SqlDbType.Int,4),
					new SqlParameter("@supplyPlanType", SqlDbType.VarChar,20),
					new SqlParameter("@isEarly", SqlDbType.Bit,1),
					new SqlParameter("@importTime", SqlDbType.DateTime),
					new SqlParameter("@supplyPlanId", SqlDbType.Int,4)};
            parameters[0].Value = model.purchaseid;
            parameters[1].Value = model.proid;
            parameters[2].Value = model.projectId;
            parameters[3].Value = model.bidid;
            parameters[4].Value = model.usework;
            parameters[5].Value = model.supplyDate;
            parameters[6].Value = model.mbm;
            parameters[7].Value = model.material;
            parameters[8].Value = model.num;
            parameters[9].Value = model.unit;
            parameters[10].Value = model.unitPrice;
            parameters[11].Value = model.technicalDataStatus;
            parameters[12].Value = model.technicalDataStatusDate;
            parameters[13].Value = model.supplyDateStatus;
            parameters[14].Value = model.supplyDateStatusDate;
            parameters[15].Value = model.arrivalCount;
            parameters[16].Value = model.contractdate;
            parameters[17].Value = model.complateDate;
            parameters[18].Value = model.fristCheckedCount;
            parameters[19].Value = model.instoreCount;
            parameters[20].Value = model.arrivalBillStatus;
            parameters[21].Value = model.arrivalEvaluationStatus;
            parameters[22].Value = model.arrivalEvaluationStatusDate;
            parameters[23].Value = model.outstoreCount;
            parameters[24].Value = model.installationStatus;
            parameters[25].Value = model.installationStatusDate;
            parameters[26].Value = model.putOperationStatus;
            parameters[27].Value = model.putOperationStatusDate;
            parameters[28].Value = model.putOperationEvaluationStaus;
            parameters[29].Value = model.putOperationEvaluationStausDate;
            parameters[30].Value = model.warrantyStatus;
            parameters[31].Value = model.warrantyStatusDate;
            parameters[32].Value = model.winBid;
            parameters[33].Value = model.warrantyEvaluationStaus;
            parameters[34].Value = model.warrantyEvaluationStausDate;
            parameters[35].Value = model.sourceProid;
            parameters[36].Value = model.sourceProjectId;
            parameters[37].Value = model.sourceProjectName;
            parameters[38].Value = model.equipmentManage;
            parameters[39].Value = model.sid;
            parameters[40].Value = model.sname;
            parameters[41].Value = model.slink;
            parameters[42].Value = model.slinkContent;
            parameters[43].Value = model.confirmDateWarn;
            parameters[44].Value = model.wasteCount;
            parameters[45].Value = model.realSupplyDate;
            parameters[46].Value = model.warrantyTime;
            parameters[47].Value = model.settlementTimeWarn;
            parameters[48].Value = model.coordinate;
            parameters[49].Value = model.deviceproductionstate;
            parameters[50].Value = model.remark;
            parameters[51].Value = model.user_id;
            parameters[52].Value = model.supplyPlanType;
            parameters[53].Value = model.isEarly;
            parameters[54].Value = model.importTime;
            parameters[55].Value = model.supplyPlanId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int supplyPlanId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from supplyPlan ");
            strSql.Append(" where supplyPlanId=@supplyPlanId");
            SqlParameter[] parameters = {
					new SqlParameter("@supplyPlanId", SqlDbType.Int,4)
			};
            parameters[0].Value = supplyPlanId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string supplyPlanIdlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from supplyPlan ");
            strSql.Append(" where supplyPlanId in (" + supplyPlanIdlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.supplyPlan GetModel(int supplyPlanId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 supplyPlanId,purchaseid,proid,projectId,bidid,usework,supplyDate,mbm,material,num,unit,unitPrice,technicalDataStatus,technicalDataStatusDate,supplyDateStatus,supplyDateStatusDate,arrivalCount,contractdate,complateDate,fristCheckedCount,instoreCount,arrivalBillStatus,arrivalEvaluationStatus,arrivalEvaluationStatusDate,outstoreCount,installationStatus,installationStatusDate,putOperationStatus,putOperationStatusDate,putOperationEvaluationStaus,putOperationEvaluationStausDate,warrantyStatus,warrantyStatusDate,winBid,warrantyEvaluationStaus,warrantyEvaluationStausDate,sourceProid,sourceProjectId,sourceProjectName,equipmentManage,sid,sname,slink,slinkContent,confirmDateWarn,wasteCount,realSupplyDate,warrantyTime,settlementTimeWarn,coordinate,deviceproductionstate,remark,user_id,supplyPlanType,isEarly,importTime from supplyPlan ");
            strSql.Append(" where supplyPlanId=@supplyPlanId");
            SqlParameter[] parameters = {
					new SqlParameter("@supplyPlanId", SqlDbType.Int,4)
			};
            parameters[0].Value = supplyPlanId;

            Maticsoft.Model.supplyPlan model = new Maticsoft.Model.supplyPlan();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["supplyPlanId"] != null && ds.Tables[0].Rows[0]["supplyPlanId"].ToString() != "")
                {
                    model.supplyPlanId = int.Parse(ds.Tables[0].Rows[0]["supplyPlanId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["purchaseid"] != null && ds.Tables[0].Rows[0]["purchaseid"].ToString() != "")
                {
                    model.purchaseid = ds.Tables[0].Rows[0]["purchaseid"].ToString();
                }
                if (ds.Tables[0].Rows[0]["proid"] != null && ds.Tables[0].Rows[0]["proid"].ToString() != "")
                {
                    model.proid = ds.Tables[0].Rows[0]["proid"].ToString();
                }
                if (ds.Tables[0].Rows[0]["projectId"] != null && ds.Tables[0].Rows[0]["projectId"].ToString() != "")
                {
                    model.projectId = int.Parse(ds.Tables[0].Rows[0]["projectId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["bidid"] != null && ds.Tables[0].Rows[0]["bidid"].ToString() != "")
                {
                    model.bidid = ds.Tables[0].Rows[0]["bidid"].ToString();
                }
                if (ds.Tables[0].Rows[0]["usework"] != null && ds.Tables[0].Rows[0]["usework"].ToString() != "")
                {
                    model.usework = ds.Tables[0].Rows[0]["usework"].ToString();
                }
                if (ds.Tables[0].Rows[0]["supplyDate"] != null && ds.Tables[0].Rows[0]["supplyDate"].ToString() != "")
                {
                    model.supplyDate = DateTime.Parse(ds.Tables[0].Rows[0]["supplyDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["mbm"] != null && ds.Tables[0].Rows[0]["mbm"].ToString() != "")
                {
                    model.mbm = ds.Tables[0].Rows[0]["mbm"].ToString();
                }
                if (ds.Tables[0].Rows[0]["material"] != null && ds.Tables[0].Rows[0]["material"].ToString() != "")
                {
                    model.material = ds.Tables[0].Rows[0]["material"].ToString();
                }
                if (ds.Tables[0].Rows[0]["num"] != null && ds.Tables[0].Rows[0]["num"].ToString() != "")
                {
                    model.num = decimal.Parse(ds.Tables[0].Rows[0]["num"].ToString());
                }
                if (ds.Tables[0].Rows[0]["unit"] != null && ds.Tables[0].Rows[0]["unit"].ToString() != "")
                {
                    model.unit = ds.Tables[0].Rows[0]["unit"].ToString();
                }
                if (ds.Tables[0].Rows[0]["unitPrice"] != null && ds.Tables[0].Rows[0]["unitPrice"].ToString() != "")
                {
                    model.unitPrice = decimal.Parse(ds.Tables[0].Rows[0]["unitPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["technicalDataStatus"] != null && ds.Tables[0].Rows[0]["technicalDataStatus"].ToString() != "")
                {
                    model.technicalDataStatus = ds.Tables[0].Rows[0]["technicalDataStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["technicalDataStatusDate"] != null && ds.Tables[0].Rows[0]["technicalDataStatusDate"].ToString() != "")
                {
                    model.technicalDataStatusDate = DateTime.Parse(ds.Tables[0].Rows[0]["technicalDataStatusDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["supplyDateStatus"] != null && ds.Tables[0].Rows[0]["supplyDateStatus"].ToString() != "")
                {
                    model.supplyDateStatus = ds.Tables[0].Rows[0]["supplyDateStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["supplyDateStatusDate"] != null && ds.Tables[0].Rows[0]["supplyDateStatusDate"].ToString() != "")
                {
                    model.supplyDateStatusDate = DateTime.Parse(ds.Tables[0].Rows[0]["supplyDateStatusDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["arrivalCount"] != null && ds.Tables[0].Rows[0]["arrivalCount"].ToString() != "")
                {
                    model.arrivalCount = decimal.Parse(ds.Tables[0].Rows[0]["arrivalCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["contractdate"] != null && ds.Tables[0].Rows[0]["contractdate"].ToString() != "")
                {
                    model.contractdate = DateTime.Parse(ds.Tables[0].Rows[0]["contractdate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["complateDate"] != null && ds.Tables[0].Rows[0]["complateDate"].ToString() != "")
                {
                    model.complateDate = DateTime.Parse(ds.Tables[0].Rows[0]["complateDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["fristCheckedCount"] != null && ds.Tables[0].Rows[0]["fristCheckedCount"].ToString() != "")
                {
                    model.fristCheckedCount = decimal.Parse(ds.Tables[0].Rows[0]["fristCheckedCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["instoreCount"] != null && ds.Tables[0].Rows[0]["instoreCount"].ToString() != "")
                {
                    model.instoreCount = decimal.Parse(ds.Tables[0].Rows[0]["instoreCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["arrivalBillStatus"] != null && ds.Tables[0].Rows[0]["arrivalBillStatus"].ToString() != "")
                {
                    model.arrivalBillStatus = ds.Tables[0].Rows[0]["arrivalBillStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["arrivalEvaluationStatus"] != null && ds.Tables[0].Rows[0]["arrivalEvaluationStatus"].ToString() != "")
                {
                    model.arrivalEvaluationStatus = ds.Tables[0].Rows[0]["arrivalEvaluationStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["arrivalEvaluationStatusDate"] != null && ds.Tables[0].Rows[0]["arrivalEvaluationStatusDate"].ToString() != "")
                {
                    model.arrivalEvaluationStatusDate = DateTime.Parse(ds.Tables[0].Rows[0]["arrivalEvaluationStatusDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["outstoreCount"] != null && ds.Tables[0].Rows[0]["outstoreCount"].ToString() != "")
                {
                    model.outstoreCount = decimal.Parse(ds.Tables[0].Rows[0]["outstoreCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["installationStatus"] != null && ds.Tables[0].Rows[0]["installationStatus"].ToString() != "")
                {
                    model.installationStatus = ds.Tables[0].Rows[0]["installationStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["installationStatusDate"] != null && ds.Tables[0].Rows[0]["installationStatusDate"].ToString() != "")
                {
                    model.installationStatusDate = DateTime.Parse(ds.Tables[0].Rows[0]["installationStatusDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["putOperationStatus"] != null && ds.Tables[0].Rows[0]["putOperationStatus"].ToString() != "")
                {
                    model.putOperationStatus = ds.Tables[0].Rows[0]["putOperationStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["putOperationStatusDate"] != null && ds.Tables[0].Rows[0]["putOperationStatusDate"].ToString() != "")
                {
                    model.putOperationStatusDate = DateTime.Parse(ds.Tables[0].Rows[0]["putOperationStatusDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["putOperationEvaluationStaus"] != null && ds.Tables[0].Rows[0]["putOperationEvaluationStaus"].ToString() != "")
                {
                    model.putOperationEvaluationStaus = ds.Tables[0].Rows[0]["putOperationEvaluationStaus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["putOperationEvaluationStausDate"] != null && ds.Tables[0].Rows[0]["putOperationEvaluationStausDate"].ToString() != "")
                {
                    model.putOperationEvaluationStausDate = DateTime.Parse(ds.Tables[0].Rows[0]["putOperationEvaluationStausDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["warrantyStatus"] != null && ds.Tables[0].Rows[0]["warrantyStatus"].ToString() != "")
                {
                    model.warrantyStatus = ds.Tables[0].Rows[0]["warrantyStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["warrantyStatusDate"] != null && ds.Tables[0].Rows[0]["warrantyStatusDate"].ToString() != "")
                {
                    model.warrantyStatusDate = DateTime.Parse(ds.Tables[0].Rows[0]["warrantyStatusDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["winBid"] != null && ds.Tables[0].Rows[0]["winBid"].ToString() != "")
                {
                    model.winBid = ds.Tables[0].Rows[0]["winBid"].ToString();
                }
                if (ds.Tables[0].Rows[0]["warrantyEvaluationStaus"] != null && ds.Tables[0].Rows[0]["warrantyEvaluationStaus"].ToString() != "")
                {
                    model.warrantyEvaluationStaus = ds.Tables[0].Rows[0]["warrantyEvaluationStaus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["warrantyEvaluationStausDate"] != null && ds.Tables[0].Rows[0]["warrantyEvaluationStausDate"].ToString() != "")
                {
                    model.warrantyEvaluationStausDate = DateTime.Parse(ds.Tables[0].Rows[0]["warrantyEvaluationStausDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sourceProid"] != null && ds.Tables[0].Rows[0]["sourceProid"].ToString() != "")
                {
                    model.sourceProid = ds.Tables[0].Rows[0]["sourceProid"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sourceProjectId"] != null && ds.Tables[0].Rows[0]["sourceProjectId"].ToString() != "")
                {
                    model.sourceProjectId = int.Parse(ds.Tables[0].Rows[0]["sourceProjectId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sourceProjectName"] != null && ds.Tables[0].Rows[0]["sourceProjectName"].ToString() != "")
                {
                    model.sourceProjectName = ds.Tables[0].Rows[0]["sourceProjectName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["equipmentManage"] != null && ds.Tables[0].Rows[0]["equipmentManage"].ToString() != "")
                {
                    model.equipmentManage = ds.Tables[0].Rows[0]["equipmentManage"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sid"] != null && ds.Tables[0].Rows[0]["sid"].ToString() != "")
                {
                    model.sid = int.Parse(ds.Tables[0].Rows[0]["sid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sname"] != null && ds.Tables[0].Rows[0]["sname"].ToString() != "")
                {
                    model.sname = ds.Tables[0].Rows[0]["sname"].ToString();
                }
                if (ds.Tables[0].Rows[0]["slink"] != null && ds.Tables[0].Rows[0]["slink"].ToString() != "")
                {
                    model.slink = ds.Tables[0].Rows[0]["slink"].ToString();
                }
                if (ds.Tables[0].Rows[0]["slinkContent"] != null && ds.Tables[0].Rows[0]["slinkContent"].ToString() != "")
                {
                    model.slinkContent = ds.Tables[0].Rows[0]["slinkContent"].ToString();
                }
                if (ds.Tables[0].Rows[0]["confirmDateWarn"] != null && ds.Tables[0].Rows[0]["confirmDateWarn"].ToString() != "")
                {
                    model.confirmDateWarn = ds.Tables[0].Rows[0]["confirmDateWarn"].ToString();
                }
                if (ds.Tables[0].Rows[0]["wasteCount"] != null && ds.Tables[0].Rows[0]["wasteCount"].ToString() != "")
                {
                    model.wasteCount = decimal.Parse(ds.Tables[0].Rows[0]["wasteCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["realSupplyDate"] != null && ds.Tables[0].Rows[0]["realSupplyDate"].ToString() != "")
                {
                    model.realSupplyDate = DateTime.Parse(ds.Tables[0].Rows[0]["realSupplyDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["warrantyTime"] != null && ds.Tables[0].Rows[0]["warrantyTime"].ToString() != "")
                {
                    model.warrantyTime = ds.Tables[0].Rows[0]["warrantyTime"].ToString();
                }
                if (ds.Tables[0].Rows[0]["settlementTimeWarn"] != null && ds.Tables[0].Rows[0]["settlementTimeWarn"].ToString() != "")
                {
                    model.settlementTimeWarn = ds.Tables[0].Rows[0]["settlementTimeWarn"].ToString();
                }
                if (ds.Tables[0].Rows[0]["coordinate"] != null && ds.Tables[0].Rows[0]["coordinate"].ToString() != "")
                {
                    model.coordinate = ds.Tables[0].Rows[0]["coordinate"].ToString();
                }
                if (ds.Tables[0].Rows[0]["deviceproductionstate"] != null && ds.Tables[0].Rows[0]["deviceproductionstate"].ToString() != "")
                {
                    model.deviceproductionstate = ds.Tables[0].Rows[0]["deviceproductionstate"].ToString();
                }
                if (ds.Tables[0].Rows[0]["remark"] != null && ds.Tables[0].Rows[0]["remark"].ToString() != "")
                {
                    model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["user_id"] != null && ds.Tables[0].Rows[0]["user_id"].ToString() != "")
                {
                    model.user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["supplyPlanType"] != null && ds.Tables[0].Rows[0]["supplyPlanType"].ToString() != "")
                {
                    model.supplyPlanType = ds.Tables[0].Rows[0]["supplyPlanType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["isEarly"] != null && ds.Tables[0].Rows[0]["isEarly"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["isEarly"].ToString() == "1") || (ds.Tables[0].Rows[0]["isEarly"].ToString().ToLower() == "true"))
                    {
                        model.isEarly = true;
                    }
                    else
                    {
                        model.isEarly = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["importTime"] != null && ds.Tables[0].Rows[0]["importTime"].ToString() != "")
                {
                    model.importTime = DateTime.Parse(ds.Tables[0].Rows[0]["importTime"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.supplyPlan DataRowToModel(DataRow row)
        {
            Maticsoft.Model.supplyPlan model = new Maticsoft.Model.supplyPlan();
            if (row != null)
            {
                if (row["supplyPlanId"] != null && row["supplyPlanId"].ToString() != "")
                {
                    model.supplyPlanId = int.Parse(row["supplyPlanId"].ToString());
                }
                if (row["purchaseid"] != null)
                {
                    model.purchaseid = row["purchaseid"].ToString();
                }
                if (row["proid"] != null)
                {
                    model.proid = row["proid"].ToString();
                }
                if (row["projectId"] != null && row["projectId"].ToString() != "")
                {
                    model.projectId = int.Parse(row["projectId"].ToString());
                }
                if (row["bidid"] != null)
                {
                    model.bidid = row["bidid"].ToString();
                }
                if (row["usework"] != null)
                {
                    model.usework = row["usework"].ToString();
                }
                if (row["supplyDate"] != null && row["supplyDate"].ToString() != "")
                {
                    model.supplyDate = DateTime.Parse(row["supplyDate"].ToString());
                }
                if (row["mbm"] != null)
                {
                    model.mbm = row["mbm"].ToString();
                }
                if (row["material"] != null)
                {
                    model.material = row["material"].ToString();
                }
                if (row["num"] != null && row["num"].ToString() != "")
                {
                    model.num = decimal.Parse(row["num"].ToString());
                }
                if (row["unit"] != null)
                {
                    model.unit = row["unit"].ToString();
                }
                if (row["unitPrice"] != null && row["unitPrice"].ToString() != "")
                {
                    model.unitPrice = decimal.Parse(row["unitPrice"].ToString());
                }
                if (row["technicalDataStatus"] != null)
                {
                    model.technicalDataStatus = row["technicalDataStatus"].ToString();
                }
                if (row["technicalDataStatusDate"] != null && row["technicalDataStatusDate"].ToString() != "")
                {
                    model.technicalDataStatusDate = DateTime.Parse(row["technicalDataStatusDate"].ToString());
                }
                if (row["supplyDateStatus"] != null)
                {
                    model.supplyDateStatus = row["supplyDateStatus"].ToString();
                }
                if (row["supplyDateStatusDate"] != null && row["supplyDateStatusDate"].ToString() != "")
                {
                    model.supplyDateStatusDate = DateTime.Parse(row["supplyDateStatusDate"].ToString());
                }
                if (row["arrivalCount"] != null && row["arrivalCount"].ToString() != "")
                {
                    model.arrivalCount = decimal.Parse(row["arrivalCount"].ToString());
                }
                if (row["contractdate"] != null && row["contractdate"].ToString() != "")
                {
                    model.contractdate = DateTime.Parse(row["contractdate"].ToString());
                }
                if (row["complateDate"] != null && row["complateDate"].ToString() != "")
                {
                    model.complateDate = DateTime.Parse(row["complateDate"].ToString());
                }
                if (row["fristCheckedCount"] != null && row["fristCheckedCount"].ToString() != "")
                {
                    model.fristCheckedCount = decimal.Parse(row["fristCheckedCount"].ToString());
                }
                if (row["instoreCount"] != null && row["instoreCount"].ToString() != "")
                {
                    model.instoreCount = decimal.Parse(row["instoreCount"].ToString());
                }
                if (row["arrivalBillStatus"] != null)
                {
                    model.arrivalBillStatus = row["arrivalBillStatus"].ToString();
                }
                if (row["arrivalEvaluationStatus"] != null)
                {
                    model.arrivalEvaluationStatus = row["arrivalEvaluationStatus"].ToString();
                }
                if (row["arrivalEvaluationStatusDate"] != null && row["arrivalEvaluationStatusDate"].ToString() != "")
                {
                    model.arrivalEvaluationStatusDate = DateTime.Parse(row["arrivalEvaluationStatusDate"].ToString());
                }
                if (row["outstoreCount"] != null && row["outstoreCount"].ToString() != "")
                {
                    model.outstoreCount = decimal.Parse(row["outstoreCount"].ToString());
                }
                if (row["installationStatus"] != null)
                {
                    model.installationStatus = row["installationStatus"].ToString();
                }
                if (row["installationStatusDate"] != null && row["installationStatusDate"].ToString() != "")
                {
                    model.installationStatusDate = DateTime.Parse(row["installationStatusDate"].ToString());
                }
                if (row["putOperationStatus"] != null)
                {
                    model.putOperationStatus = row["putOperationStatus"].ToString();
                }
                if (row["putOperationStatusDate"] != null && row["putOperationStatusDate"].ToString() != "")
                {
                    model.putOperationStatusDate = DateTime.Parse(row["putOperationStatusDate"].ToString());
                }
                if (row["putOperationEvaluationStaus"] != null)
                {
                    model.putOperationEvaluationStaus = row["putOperationEvaluationStaus"].ToString();
                }
                if (row["putOperationEvaluationStausDate"] != null && row["putOperationEvaluationStausDate"].ToString() != "")
                {
                    model.putOperationEvaluationStausDate = DateTime.Parse(row["putOperationEvaluationStausDate"].ToString());
                }
                if (row["warrantyStatus"] != null)
                {
                    model.warrantyStatus = row["warrantyStatus"].ToString();
                }
                if (row["warrantyStatusDate"] != null && row["warrantyStatusDate"].ToString() != "")
                {
                    model.warrantyStatusDate = DateTime.Parse(row["warrantyStatusDate"].ToString());
                }
                if (row["winBid"] != null)
                {
                    model.winBid = row["winBid"].ToString();
                }
                if (row["warrantyEvaluationStaus"] != null)
                {
                    model.warrantyEvaluationStaus = row["warrantyEvaluationStaus"].ToString();
                }
                if (row["warrantyEvaluationStausDate"] != null && row["warrantyEvaluationStausDate"].ToString() != "")
                {
                    model.warrantyEvaluationStausDate = DateTime.Parse(row["warrantyEvaluationStausDate"].ToString());
                }
                if (row["sourceProid"] != null)
                {
                    model.sourceProid = row["sourceProid"].ToString();
                }
                if (row["sourceProjectId"] != null && row["sourceProjectId"].ToString() != "")
                {
                    model.sourceProjectId = int.Parse(row["sourceProjectId"].ToString());
                }
                if (row["sourceProjectName"] != null)
                {
                    model.sourceProjectName = row["sourceProjectName"].ToString();
                }
                if (row["equipmentManage"] != null)
                {
                    model.equipmentManage = row["equipmentManage"].ToString();
                }
                if (row["sid"] != null && row["sid"].ToString() != "")
                {
                    model.sid = int.Parse(row["sid"].ToString());
                }
                if (row["sname"] != null)
                {
                    model.sname = row["sname"].ToString();
                }
                if (row["slink"] != null)
                {
                    model.slink = row["slink"].ToString();
                }
                if (row["slinkContent"] != null)
                {
                    model.slinkContent = row["slinkContent"].ToString();
                }
                if (row["confirmDateWarn"] != null)
                {
                    model.confirmDateWarn = row["confirmDateWarn"].ToString();
                }
                if (row["wasteCount"] != null && row["wasteCount"].ToString() != "")
                {
                    model.wasteCount = decimal.Parse(row["wasteCount"].ToString());
                }
                if (row["realSupplyDate"] != null && row["realSupplyDate"].ToString() != "")
                {
                    model.realSupplyDate = DateTime.Parse(row["realSupplyDate"].ToString());
                }
                if (row["warrantyTime"] != null)
                {
                    model.warrantyTime = row["warrantyTime"].ToString();
                }
                if (row["settlementTimeWarn"] != null)
                {
                    model.settlementTimeWarn = row["settlementTimeWarn"].ToString();
                }
                if (row["coordinate"] != null)
                {
                    model.coordinate = row["coordinate"].ToString();
                }
                if (row["deviceproductionstate"] != null)
                {
                    model.deviceproductionstate = row["deviceproductionstate"].ToString();
                }
                if (row["remark"] != null)
                {
                    model.remark = row["remark"].ToString();
                }
                if (row["user_id"] != null && row["user_id"].ToString() != "")
                {
                    model.user_id = int.Parse(row["user_id"].ToString());
                }
                if (row["supplyPlanType"] != null)
                {
                    model.supplyPlanType = row["supplyPlanType"].ToString();
                }
                if (row["isEarly"] != null && row["isEarly"].ToString() != "")
                {
                    if ((row["isEarly"].ToString() == "1") || (row["isEarly"].ToString().ToLower() == "true"))
                    {
                        model.isEarly = true;
                    }
                    else
                    {
                        model.isEarly = false;
                    }
                }
                if (row["importTime"] != null && row["importTime"].ToString() != "")
                {
                    model.importTime = DateTime.Parse(row["importTime"].ToString());
                }
            }
            return model;
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" supplyPlanId,purchaseid,proid,projectId,bidid,usework,supplyDate,mbm,material,num,unit,unitPrice,technicalDataStatus,technicalDataStatusDate,supplyDateStatus,supplyDateStatusDate,arrivalCount,contractdate,complateDate,fristCheckedCount,instoreCount,arrivalBillStatus,arrivalEvaluationStatus,arrivalEvaluationStatusDate,outstoreCount,installationStatus,installationStatusDate,putOperationStatus,putOperationStatusDate,putOperationEvaluationStaus,putOperationEvaluationStausDate,warrantyStatus,warrantyStatusDate,winBid,warrantyEvaluationStaus,warrantyEvaluationStausDate,sourceProid,sourceProjectId,sourceProjectName,equipmentManage,sid,sname,slink,slinkContent,confirmDateWarn,wasteCount,realSupplyDate,warrantyTime,settlementTimeWarn,coordinate,deviceproductionstate,remark,user_id,supplyPlanType,isEarly,importTime ");
            strSql.Append(" FROM supplyPlan ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM supplyPlan ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.supplyPlanId desc");
            }
            strSql.Append(")AS Row, T.*  from supplyPlan T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "supplyPlan";
            parameters[1].Value = "supplyPlanId";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  Method
        #region  BasicMethod

        ///// <summary>
        ///// 得到最大ID
        ///// </summary>
        //public int GetMaxId()
        //{
        //    return DbHelperSQL.GetMaxID("supplyPlanId", "supplyPlan");
        //}

        ///// <summary>
        ///// 是否存在该记录
        ///// </summary>
        //public bool Exists(int supplyPlanId)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select count(1) from supplyPlan");
        //    strSql.Append(" where supplyPlanId=@supplyPlanId");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@supplyPlanId", SqlDbType.Int,4)
        //    };
        //    parameters[0].Value = supplyPlanId;

        //    return DbHelperSQL.Exists(strSql.ToString(), parameters);
        //}


        ///// <summary>
        ///// 增加一条数据
        ///// </summary>
        //public int Add(Maticsoft.Model.supplyPlan model)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("insert into supplyPlan(");
        //    strSql.Append("purchaseid,proid,projectId,bidid,usework,supplyDate,mbm,material,num,unit,unitPrice,technicalDataStatus,technicalDataStatusDate,supplyDateStatus,supplyDateStatusDate,arrivalCount,contractdate,complateDate,fristCheckedCount,instoreCount,arrivalBillStatus,arrivalEvaluationStatus,arrivalEvaluationStatusDate,outstoreCount,installationStatus,installationStatusDate,putOperationStatus,putOperationStatusDate,putOperationEvaluationStaus,putOperationEvaluationStausDate,warrantyStatus,warrantyStatusDate,winBid,warrantyEvaluationStaus,warrantyEvaluationStausDate,sourceProid,sourceProjectId,sourceProjectName,equipmentManage,sid,sname,slink,slinkContent,confirmDateWarn,wasteCount,realSupplyDate,warrantyTime,settlementTimeWarn,coordinate,deviceproductionstate,remark,user_id,supplyPlanType,isEarly)");
        //    strSql.Append(" values (");
        //    strSql.Append("@purchaseid,@proid,@projectId,@bidid,@usework,@supplyDate,@mbm,@material,@num,@unit,@unitPrice,@technicalDataStatus,@technicalDataStatusDate,@supplyDateStatus,@supplyDateStatusDate,@arrivalCount,@contractdate,@complateDate,@fristCheckedCount,@instoreCount,@arrivalBillStatus,@arrivalEvaluationStatus,@arrivalEvaluationStatusDate,@outstoreCount,@installationStatus,@installationStatusDate,@putOperationStatus,@putOperationStatusDate,@putOperationEvaluationStaus,@putOperationEvaluationStausDate,@warrantyStatus,@warrantyStatusDate,@winBid,@warrantyEvaluationStaus,@warrantyEvaluationStausDate,@sourceProid,@sourceProjectId,@sourceProjectName,@equipmentManage,@sid,@sname,@slink,@slinkContent,@confirmDateWarn,@wasteCount,@realSupplyDate,@warrantyTime,@settlementTimeWarn,@coordinate,@deviceproductionstate,@remark,@user_id,@supplyPlanType,@isEarly)");
        //    strSql.Append(";select @@IDENTITY");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@purchaseid", SqlDbType.VarChar,50),
        //            new SqlParameter("@proid", SqlDbType.NVarChar,50),
        //            new SqlParameter("@projectId", SqlDbType.Int,4),
        //            new SqlParameter("@bidid", SqlDbType.VarChar,50),
        //            new SqlParameter("@usework", SqlDbType.VarChar,50),
        //            new SqlParameter("@supplyDate", SqlDbType.DateTime),
        //            new SqlParameter("@mbm", SqlDbType.NVarChar,50),
        //            new SqlParameter("@material", SqlDbType.NVarChar,250),
        //            new SqlParameter("@num", SqlDbType.Decimal,9),
        //            new SqlParameter("@unit", SqlDbType.NChar,10),
        //            new SqlParameter("@unitPrice", SqlDbType.Money,8),
        //            new SqlParameter("@technicalDataStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@technicalDataStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@supplyDateStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@supplyDateStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@arrivalCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@contractdate", SqlDbType.DateTime),
        //            new SqlParameter("@complateDate", SqlDbType.DateTime),
        //            new SqlParameter("@fristCheckedCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@instoreCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@arrivalBillStatus", SqlDbType.VarChar,50),
        //            new SqlParameter("@arrivalEvaluationStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@arrivalEvaluationStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@outstoreCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@installationStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@installationStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@putOperationStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@putOperationStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@putOperationEvaluationStaus", SqlDbType.VarChar,10),
        //            new SqlParameter("@putOperationEvaluationStausDate", SqlDbType.DateTime),
        //            new SqlParameter("@warrantyStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@warrantyStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@winBid", SqlDbType.VarChar,30),
        //            new SqlParameter("@warrantyEvaluationStaus", SqlDbType.VarChar,10),
        //            new SqlParameter("@warrantyEvaluationStausDate", SqlDbType.DateTime),
        //            new SqlParameter("@sourceProid", SqlDbType.NVarChar,50),
        //            new SqlParameter("@sourceProjectId", SqlDbType.Int,4),
        //            new SqlParameter("@sourceProjectName", SqlDbType.VarChar,50),
        //            new SqlParameter("@equipmentManage", SqlDbType.VarChar,50),
        //            new SqlParameter("@sid", SqlDbType.Int,4),
        //            new SqlParameter("@sname", SqlDbType.VarChar,50),
        //            new SqlParameter("@slink", SqlDbType.NVarChar,50),
        //            new SqlParameter("@slinkContent", SqlDbType.VarChar,50),
        //            new SqlParameter("@confirmDateWarn", SqlDbType.VarChar,30),
        //            new SqlParameter("@wasteCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@realSupplyDate", SqlDbType.DateTime),
        //            new SqlParameter("@warrantyTime", SqlDbType.VarChar,10),
        //            new SqlParameter("@settlementTimeWarn", SqlDbType.VarChar,10),
        //            new SqlParameter("@coordinate", SqlDbType.VarChar,50),
        //            new SqlParameter("@deviceproductionstate", SqlDbType.VarChar,50),
        //            new SqlParameter("@remark", SqlDbType.NVarChar,500),
        //            new SqlParameter("@user_id", SqlDbType.Int,4),
        //            new SqlParameter("@supplyPlanType", SqlDbType.VarChar,20),
        //            new SqlParameter("@isEarly", SqlDbType.Bit,1)};
        //    parameters[0].Value = model.purchaseid;
        //    parameters[1].Value = model.proid;
        //    parameters[2].Value = model.projectId;
        //    parameters[3].Value = model.bidid;
        //    parameters[4].Value = model.usework;
        //    parameters[5].Value = model.supplyDate;
        //    parameters[6].Value = model.mbm;
        //    parameters[7].Value = model.material;
        //    parameters[8].Value = model.num;
        //    parameters[9].Value = model.unit;
        //    parameters[10].Value = model.unitPrice;
        //    parameters[11].Value = model.technicalDataStatus;
        //    parameters[12].Value = model.technicalDataStatusDate;
        //    parameters[13].Value = model.supplyDateStatus;
        //    parameters[14].Value = model.supplyDateStatusDate;
        //    parameters[15].Value = model.arrivalCount;
        //    parameters[16].Value = model.contractdate;
        //    parameters[17].Value = model.complateDate;
        //    parameters[18].Value = model.fristCheckedCount;
        //    parameters[19].Value = model.instoreCount;
        //    parameters[20].Value = model.arrivalBillStatus;
        //    parameters[21].Value = model.arrivalEvaluationStatus;
        //    parameters[22].Value = model.arrivalEvaluationStatusDate;
        //    parameters[23].Value = model.outstoreCount;
        //    parameters[24].Value = model.installationStatus;
        //    parameters[25].Value = model.installationStatusDate;
        //    parameters[26].Value = model.putOperationStatus;
        //    parameters[27].Value = model.putOperationStatusDate;
        //    parameters[28].Value = model.putOperationEvaluationStaus;
        //    parameters[29].Value = model.putOperationEvaluationStausDate;
        //    parameters[30].Value = model.warrantyStatus;
        //    parameters[31].Value = model.warrantyStatusDate;
        //    parameters[32].Value = model.winBid;
        //    parameters[33].Value = model.warrantyEvaluationStaus;
        //    parameters[34].Value = model.warrantyEvaluationStausDate;
        //    parameters[35].Value = model.sourceProid;
        //    parameters[36].Value = model.sourceProjectId;
        //    parameters[37].Value = model.sourceProjectName;
        //    parameters[38].Value = model.equipmentManage;
        //    parameters[39].Value = model.sid;
        //    parameters[40].Value = model.sname;
        //    parameters[41].Value = model.slink;
        //    parameters[42].Value = model.slinkContent;
        //    parameters[43].Value = model.confirmDateWarn;
        //    parameters[44].Value = model.wasteCount;
        //    parameters[45].Value = model.realSupplyDate;
        //    parameters[46].Value = model.warrantyTime;
        //    parameters[47].Value = model.settlementTimeWarn;
        //    parameters[48].Value = model.coordinate;
        //    parameters[49].Value = model.deviceproductionstate;
        //    parameters[50].Value = model.remark;
        //    parameters[51].Value = model.user_id;
        //    parameters[52].Value = model.supplyPlanType;
        //    parameters[53].Value = model.isEarly;

        //    object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
        //    if (obj == null)
        //    {
        //        return 0;
        //    }
        //    else
        //    {
        //        return Convert.ToInt32(obj);
        //    }
        //}
        ///// <summary>
        ///// 更新一条数据
        ///// </summary>
        //public bool Update(Maticsoft.Model.supplyPlan model)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("update supplyPlan set ");
        //    strSql.Append("purchaseid=@purchaseid,");
        //    strSql.Append("proid=@proid,");
        //    strSql.Append("projectId=@projectId,");
        //    strSql.Append("bidid=@bidid,");
        //    strSql.Append("usework=@usework,");
        //    strSql.Append("supplyDate=@supplyDate,");
        //    strSql.Append("mbm=@mbm,");
        //    strSql.Append("material=@material,");
        //    strSql.Append("num=@num,");
        //    strSql.Append("unit=@unit,");
        //    strSql.Append("unitPrice=@unitPrice,");
        //    strSql.Append("technicalDataStatus=@technicalDataStatus,");
        //    strSql.Append("technicalDataStatusDate=@technicalDataStatusDate,");
        //    strSql.Append("supplyDateStatus=@supplyDateStatus,");
        //    strSql.Append("supplyDateStatusDate=@supplyDateStatusDate,");
        //    strSql.Append("arrivalCount=@arrivalCount,");
        //    strSql.Append("contractdate=@contractdate,");
        //    strSql.Append("complateDate=@complateDate,");
        //    strSql.Append("fristCheckedCount=@fristCheckedCount,");
        //    strSql.Append("instoreCount=@instoreCount,");
        //    strSql.Append("arrivalBillStatus=@arrivalBillStatus,");
        //    strSql.Append("arrivalEvaluationStatus=@arrivalEvaluationStatus,");
        //    strSql.Append("arrivalEvaluationStatusDate=@arrivalEvaluationStatusDate,");
        //    strSql.Append("outstoreCount=@outstoreCount,");
        //    strSql.Append("installationStatus=@installationStatus,");
        //    strSql.Append("installationStatusDate=@installationStatusDate,");
        //    strSql.Append("putOperationStatus=@putOperationStatus,");
        //    strSql.Append("putOperationStatusDate=@putOperationStatusDate,");
        //    strSql.Append("putOperationEvaluationStaus=@putOperationEvaluationStaus,");
        //    strSql.Append("putOperationEvaluationStausDate=@putOperationEvaluationStausDate,");
        //    strSql.Append("warrantyStatus=@warrantyStatus,");
        //    strSql.Append("warrantyStatusDate=@warrantyStatusDate,");
        //    strSql.Append("winBid=@winBid,");
        //    strSql.Append("warrantyEvaluationStaus=@warrantyEvaluationStaus,");
        //    strSql.Append("warrantyEvaluationStausDate=@warrantyEvaluationStausDate,");
        //    strSql.Append("sourceProid=@sourceProid,");
        //    strSql.Append("sourceProjectId=@sourceProjectId,");
        //    strSql.Append("sourceProjectName=@sourceProjectName,");
        //    strSql.Append("equipmentManage=@equipmentManage,");
        //    strSql.Append("sid=@sid,");
        //    strSql.Append("sname=@sname,");
        //    strSql.Append("slink=@slink,");
        //    strSql.Append("slinkContent=@slinkContent,");
        //    strSql.Append("confirmDateWarn=@confirmDateWarn,");
        //    strSql.Append("wasteCount=@wasteCount,");
        //    strSql.Append("realSupplyDate=@realSupplyDate,");
        //    strSql.Append("warrantyTime=@warrantyTime,");
        //    strSql.Append("settlementTimeWarn=@settlementTimeWarn,");
        //    strSql.Append("coordinate=@coordinate,");
        //    strSql.Append("deviceproductionstate=@deviceproductionstate,");
        //    strSql.Append("remark=@remark,");
        //    strSql.Append("user_id=@user_id,");
        //    strSql.Append("supplyPlanType=@supplyPlanType,");
        //    strSql.Append("isEarly=@isEarly");
        //    strSql.Append(" where supplyPlanId=@supplyPlanId");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@purchaseid", SqlDbType.VarChar,50),
        //            new SqlParameter("@proid", SqlDbType.NVarChar,50),
        //            new SqlParameter("@projectId", SqlDbType.Int,4),
        //            new SqlParameter("@bidid", SqlDbType.VarChar,50),
        //            new SqlParameter("@usework", SqlDbType.VarChar,50),
        //            new SqlParameter("@supplyDate", SqlDbType.DateTime),
        //            new SqlParameter("@mbm", SqlDbType.NVarChar,50),
        //            new SqlParameter("@material", SqlDbType.NVarChar,250),
        //            new SqlParameter("@num", SqlDbType.Decimal,9),
        //            new SqlParameter("@unit", SqlDbType.NChar,10),
        //            new SqlParameter("@unitPrice", SqlDbType.Money,8),
        //            new SqlParameter("@technicalDataStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@technicalDataStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@supplyDateStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@supplyDateStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@arrivalCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@contractdate", SqlDbType.DateTime),
        //            new SqlParameter("@complateDate", SqlDbType.DateTime),
        //            new SqlParameter("@fristCheckedCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@instoreCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@arrivalBillStatus", SqlDbType.VarChar,50),
        //            new SqlParameter("@arrivalEvaluationStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@arrivalEvaluationStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@outstoreCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@installationStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@installationStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@putOperationStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@putOperationStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@putOperationEvaluationStaus", SqlDbType.VarChar,10),
        //            new SqlParameter("@putOperationEvaluationStausDate", SqlDbType.DateTime),
        //            new SqlParameter("@warrantyStatus", SqlDbType.VarChar,10),
        //            new SqlParameter("@warrantyStatusDate", SqlDbType.DateTime),
        //            new SqlParameter("@winBid", SqlDbType.VarChar,30),
        //            new SqlParameter("@warrantyEvaluationStaus", SqlDbType.VarChar,10),
        //            new SqlParameter("@warrantyEvaluationStausDate", SqlDbType.DateTime),
        //            new SqlParameter("@sourceProid", SqlDbType.NVarChar,50),
        //            new SqlParameter("@sourceProjectId", SqlDbType.Int,4),
        //            new SqlParameter("@sourceProjectName", SqlDbType.VarChar,50),
        //            new SqlParameter("@equipmentManage", SqlDbType.VarChar,50),
        //            new SqlParameter("@sid", SqlDbType.Int,4),
        //            new SqlParameter("@sname", SqlDbType.VarChar,50),
        //            new SqlParameter("@slink", SqlDbType.NVarChar,50),
        //            new SqlParameter("@slinkContent", SqlDbType.VarChar,50),
        //            new SqlParameter("@confirmDateWarn", SqlDbType.VarChar,30),
        //            new SqlParameter("@wasteCount", SqlDbType.Decimal,9),
        //            new SqlParameter("@realSupplyDate", SqlDbType.DateTime),
        //            new SqlParameter("@warrantyTime", SqlDbType.VarChar,10),
        //            new SqlParameter("@settlementTimeWarn", SqlDbType.VarChar,10),
        //            new SqlParameter("@coordinate", SqlDbType.VarChar,50),
        //            new SqlParameter("@deviceproductionstate", SqlDbType.VarChar,50),
        //            new SqlParameter("@remark", SqlDbType.NVarChar,500),
        //            new SqlParameter("@user_id", SqlDbType.Int,4),
        //            new SqlParameter("@supplyPlanType", SqlDbType.VarChar,20),
        //            new SqlParameter("@isEarly", SqlDbType.Bit,1),
        //            new SqlParameter("@supplyPlanId", SqlDbType.Int,4)};
        //    parameters[0].Value = model.purchaseid;
        //    parameters[1].Value = model.proid;
        //    parameters[2].Value = model.projectId;
        //    parameters[3].Value = model.bidid;
        //    parameters[4].Value = model.usework;
        //    parameters[5].Value = model.supplyDate;
        //    parameters[6].Value = model.mbm;
        //    parameters[7].Value = model.material;
        //    parameters[8].Value = model.num;
        //    parameters[9].Value = model.unit;
        //    parameters[10].Value = model.unitPrice;
        //    parameters[11].Value = model.technicalDataStatus;
        //    parameters[12].Value = model.technicalDataStatusDate;
        //    parameters[13].Value = model.supplyDateStatus;
        //    parameters[14].Value = model.supplyDateStatusDate;
        //    parameters[15].Value = model.arrivalCount;
        //    parameters[16].Value = model.contractdate;
        //    parameters[17].Value = model.complateDate;
        //    parameters[18].Value = model.fristCheckedCount;
        //    parameters[19].Value = model.instoreCount;
        //    parameters[20].Value = model.arrivalBillStatus;
        //    parameters[21].Value = model.arrivalEvaluationStatus;
        //    parameters[22].Value = model.arrivalEvaluationStatusDate;
        //    parameters[23].Value = model.outstoreCount;
        //    parameters[24].Value = model.installationStatus;
        //    parameters[25].Value = model.installationStatusDate;
        //    parameters[26].Value = model.putOperationStatus;
        //    parameters[27].Value = model.putOperationStatusDate;
        //    parameters[28].Value = model.putOperationEvaluationStaus;
        //    parameters[29].Value = model.putOperationEvaluationStausDate;
        //    parameters[30].Value = model.warrantyStatus;
        //    parameters[31].Value = model.warrantyStatusDate;
        //    parameters[32].Value = model.winBid;
        //    parameters[33].Value = model.warrantyEvaluationStaus;
        //    parameters[34].Value = model.warrantyEvaluationStausDate;
        //    parameters[35].Value = model.sourceProid;
        //    parameters[36].Value = model.sourceProjectId;
        //    parameters[37].Value = model.sourceProjectName;
        //    parameters[38].Value = model.equipmentManage;
        //    parameters[39].Value = model.sid;
        //    parameters[40].Value = model.sname;
        //    parameters[41].Value = model.slink;
        //    parameters[42].Value = model.slinkContent;
        //    parameters[43].Value = model.confirmDateWarn;
        //    parameters[44].Value = model.wasteCount;
        //    parameters[45].Value = model.realSupplyDate;
        //    parameters[46].Value = model.warrantyTime;
        //    parameters[47].Value = model.settlementTimeWarn;
        //    parameters[48].Value = model.coordinate;
        //    parameters[49].Value = model.deviceproductionstate;
        //    parameters[50].Value = model.remark;
        //    parameters[51].Value = model.user_id;
        //    parameters[52].Value = model.supplyPlanType;
        //    parameters[53].Value = model.isEarly;
        //    parameters[54].Value = model.supplyPlanId;

        //    int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        //    if (rows > 0)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}

        ///// <summary>
        ///// 删除一条数据
        ///// </summary>
        //public bool Delete(int supplyPlanId)
        //{

        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("delete from supplyPlan ");
        //    strSql.Append(" where supplyPlanId=@supplyPlanId");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@supplyPlanId", SqlDbType.Int,4)
        //    };
        //    parameters[0].Value = supplyPlanId;

        //    int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        //    if (rows > 0)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}
        ///// <summary>
        ///// 批量删除数据
        ///// </summary>
        //public bool DeleteList(string supplyPlanIdlist)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("delete from supplyPlan ");
        //    strSql.Append(" where supplyPlanId in (" + supplyPlanIdlist + ")  ");
        //    int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
        //    if (rows > 0)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}


        ///// <summary>
        ///// 得到一个对象实体
        ///// </summary>
        //public Maticsoft.Model.supplyPlan GetModel(int supplyPlanId)
        //{

        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select  top 1 supplyPlanId,purchaseid,proid,projectId,bidid,usework,supplyDate,mbm,material,num,unit,unitPrice,technicalDataStatus,technicalDataStatusDate,supplyDateStatus,supplyDateStatusDate,arrivalCount,contractdate,complateDate,fristCheckedCount,instoreCount,arrivalBillStatus,arrivalEvaluationStatus,arrivalEvaluationStatusDate,outstoreCount,installationStatus,installationStatusDate,putOperationStatus,putOperationStatusDate,putOperationEvaluationStaus,putOperationEvaluationStausDate,warrantyStatus,warrantyStatusDate,winBid,warrantyEvaluationStaus,warrantyEvaluationStausDate,sourceProid,sourceProjectId,sourceProjectName,equipmentManage,sid,sname,slink,slinkContent,confirmDateWarn,wasteCount,realSupplyDate,warrantyTime,settlementTimeWarn,coordinate,deviceproductionstate,remark,user_id,supplyPlanType,isEarly from supplyPlan ");
        //    strSql.Append(" where supplyPlanId=@supplyPlanId");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@supplyPlanId", SqlDbType.Int,4)
        //    };
        //    parameters[0].Value = supplyPlanId;

        //    Maticsoft.Model.supplyPlan model = new Maticsoft.Model.supplyPlan();
        //    DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
        //    if (ds.Tables[0].Rows.Count > 0)
        //    {
        //        return DataRowToModel(ds.Tables[0].Rows[0]);
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}


        ///// <summary>
        ///// 得到一个对象实体
        ///// </summary>
        //public Maticsoft.Model.supplyPlan DataRowToModel(DataRow row)
        //{
        //    Maticsoft.Model.supplyPlan model = new Maticsoft.Model.supplyPlan();
        //    if (row != null)
        //    {
        //        if (row["supplyPlanId"] != null && row["supplyPlanId"].ToString() != "")
        //        {
        //            model.supplyPlanId = int.Parse(row["supplyPlanId"].ToString());
        //        }
        //        if (row["purchaseid"] != null)
        //        {
        //            model.purchaseid = row["purchaseid"].ToString();
        //        }
        //        if (row["proid"] != null)
        //        {
        //            model.proid = row["proid"].ToString();
        //        }
        //        if (row["projectId"] != null && row["projectId"].ToString() != "")
        //        {
        //            model.projectId = int.Parse(row["projectId"].ToString());
        //        }
        //        if (row["bidid"] != null)
        //        {
        //            model.bidid = row["bidid"].ToString();
        //        }
        //        if (row["usework"] != null)
        //        {
        //            model.usework = row["usework"].ToString();
        //        }
        //        if (row["supplyDate"] != null && row["supplyDate"].ToString() != "")
        //        {
        //            model.supplyDate = DateTime.Parse(row["supplyDate"].ToString());
        //        }
        //        if (row["mbm"] != null)
        //        {
        //            model.mbm = row["mbm"].ToString();
        //        }
        //        if (row["material"] != null)
        //        {
        //            model.material = row["material"].ToString();
        //        }
        //        if (row["num"] != null && row["num"].ToString() != "")
        //        {
        //            model.num = decimal.Parse(row["num"].ToString());
        //        }
        //        if (row["unit"] != null)
        //        {
        //            model.unit = row["unit"].ToString();
        //        }
        //        if (row["unitPrice"] != null && row["unitPrice"].ToString() != "")
        //        {
        //            model.unitPrice = decimal.Parse(row["unitPrice"].ToString());
        //        }
        //        if (row["technicalDataStatus"] != null)
        //        {
        //            model.technicalDataStatus = row["technicalDataStatus"].ToString();
        //        }
        //        if (row["technicalDataStatusDate"] != null && row["technicalDataStatusDate"].ToString() != "")
        //        {
        //            model.technicalDataStatusDate = DateTime.Parse(row["technicalDataStatusDate"].ToString());
        //        }
        //        if (row["supplyDateStatus"] != null)
        //        {
        //            model.supplyDateStatus = row["supplyDateStatus"].ToString();
        //        }
        //        if (row["supplyDateStatusDate"] != null && row["supplyDateStatusDate"].ToString() != "")
        //        {
        //            model.supplyDateStatusDate = DateTime.Parse(row["supplyDateStatusDate"].ToString());
        //        }
        //        if (row["arrivalCount"] != null && row["arrivalCount"].ToString() != "")
        //        {
        //            model.arrivalCount = decimal.Parse(row["arrivalCount"].ToString());
        //        }
        //        if (row["contractdate"] != null && row["contractdate"].ToString() != "")
        //        {
        //            model.contractdate = DateTime.Parse(row["contractdate"].ToString());
        //        }
        //        if (row["complateDate"] != null && row["complateDate"].ToString() != "")
        //        {
        //            model.complateDate = DateTime.Parse(row["complateDate"].ToString());
        //        }
        //        if (row["fristCheckedCount"] != null && row["fristCheckedCount"].ToString() != "")
        //        {
        //            model.fristCheckedCount = decimal.Parse(row["fristCheckedCount"].ToString());
        //        }
        //        if (row["instoreCount"] != null && row["instoreCount"].ToString() != "")
        //        {
        //            model.instoreCount = decimal.Parse(row["instoreCount"].ToString());
        //        }
        //        if (row["arrivalBillStatus"] != null)
        //        {
        //            model.arrivalBillStatus = row["arrivalBillStatus"].ToString();
        //        }
        //        if (row["arrivalEvaluationStatus"] != null)
        //        {
        //            model.arrivalEvaluationStatus = row["arrivalEvaluationStatus"].ToString();
        //        }
        //        if (row["arrivalEvaluationStatusDate"] != null && row["arrivalEvaluationStatusDate"].ToString() != "")
        //        {
        //            model.arrivalEvaluationStatusDate = DateTime.Parse(row["arrivalEvaluationStatusDate"].ToString());
        //        }
        //        if (row["outstoreCount"] != null && row["outstoreCount"].ToString() != "")
        //        {
        //            model.outstoreCount = decimal.Parse(row["outstoreCount"].ToString());
        //        }
        //        if (row["installationStatus"] != null)
        //        {
        //            model.installationStatus = row["installationStatus"].ToString();
        //        }
        //        if (row["installationStatusDate"] != null && row["installationStatusDate"].ToString() != "")
        //        {
        //            model.installationStatusDate = DateTime.Parse(row["installationStatusDate"].ToString());
        //        }
        //        if (row["putOperationStatus"] != null)
        //        {
        //            model.putOperationStatus = row["putOperationStatus"].ToString();
        //        }
        //        if (row["putOperationStatusDate"] != null && row["putOperationStatusDate"].ToString() != "")
        //        {
        //            model.putOperationStatusDate = DateTime.Parse(row["putOperationStatusDate"].ToString());
        //        }
        //        if (row["putOperationEvaluationStaus"] != null)
        //        {
        //            model.putOperationEvaluationStaus = row["putOperationEvaluationStaus"].ToString();
        //        }
        //        if (row["putOperationEvaluationStausDate"] != null && row["putOperationEvaluationStausDate"].ToString() != "")
        //        {
        //            model.putOperationEvaluationStausDate = DateTime.Parse(row["putOperationEvaluationStausDate"].ToString());
        //        }
        //        if (row["warrantyStatus"] != null)
        //        {
        //            model.warrantyStatus = row["warrantyStatus"].ToString();
        //        }
        //        if (row["warrantyStatusDate"] != null && row["warrantyStatusDate"].ToString() != "")
        //        {
        //            model.warrantyStatusDate = DateTime.Parse(row["warrantyStatusDate"].ToString());
        //        }
        //        if (row["winBid"] != null)
        //        {
        //            model.winBid = row["winBid"].ToString();
        //        }
        //        if (row["warrantyEvaluationStaus"] != null)
        //        {
        //            model.warrantyEvaluationStaus = row["warrantyEvaluationStaus"].ToString();
        //        }
        //        if (row["warrantyEvaluationStausDate"] != null && row["warrantyEvaluationStausDate"].ToString() != "")
        //        {
        //            model.warrantyEvaluationStausDate = DateTime.Parse(row["warrantyEvaluationStausDate"].ToString());
        //        }
        //        if (row["sourceProid"] != null)
        //        {
        //            model.sourceProid = row["sourceProid"].ToString();
        //        }
        //        if (row["sourceProjectId"] != null && row["sourceProjectId"].ToString() != "")
        //        {
        //            model.sourceProjectId = int.Parse(row["sourceProjectId"].ToString());
        //        }
        //        if (row["sourceProjectName"] != null)
        //        {
        //            model.sourceProjectName = row["sourceProjectName"].ToString();
        //        }
        //        if (row["equipmentManage"] != null)
        //        {
        //            model.equipmentManage = row["equipmentManage"].ToString();
        //        }
        //        if (row["sid"] != null && row["sid"].ToString() != "")
        //        {
        //            model.sid = int.Parse(row["sid"].ToString());
        //        }
        //        if (row["sname"] != null)
        //        {
        //            model.sname = row["sname"].ToString();
        //        }
        //        if (row["slink"] != null)
        //        {
        //            model.slink = row["slink"].ToString();
        //        }
        //        if (row["slinkContent"] != null)
        //        {
        //            model.slinkContent = row["slinkContent"].ToString();
        //        }
        //        if (row["confirmDateWarn"] != null)
        //        {
        //            model.confirmDateWarn = row["confirmDateWarn"].ToString();
        //        }
        //        if (row["wasteCount"] != null && row["wasteCount"].ToString() != "")
        //        {
        //            model.wasteCount = decimal.Parse(row["wasteCount"].ToString());
        //        }
        //        if (row["realSupplyDate"] != null && row["realSupplyDate"].ToString() != "")
        //        {
        //            model.realSupplyDate = DateTime.Parse(row["realSupplyDate"].ToString());
        //        }
        //        if (row["warrantyTime"] != null)
        //        {
        //            model.warrantyTime = row["warrantyTime"].ToString();
        //        }
        //        if (row["settlementTimeWarn"] != null)
        //        {
        //            model.settlementTimeWarn = row["settlementTimeWarn"].ToString();
        //        }
        //        if (row["coordinate"] != null)
        //        {
        //            model.coordinate = row["coordinate"].ToString();
        //        }
        //        if (row["deviceproductionstate"] != null)
        //        {
        //            model.deviceproductionstate = row["deviceproductionstate"].ToString();
        //        }
        //        if (row["remark"] != null)
        //        {
        //            model.remark = row["remark"].ToString();
        //        }
        //        if (row["user_id"] != null && row["user_id"].ToString() != "")
        //        {
        //            model.user_id = int.Parse(row["user_id"].ToString());
        //        }
        //        if (row["supplyPlanType"] != null)
        //        {
        //            model.supplyPlanType = row["supplyPlanType"].ToString();
        //        }
        //        if (row["isEarly"] != null && row["isEarly"].ToString() != "")
        //        {
        //            if ((row["isEarly"].ToString() == "1") || (row["isEarly"].ToString().ToLower() == "true"))
        //            {
        //                model.isEarly = true;
        //            }
        //            else
        //            {
        //                model.isEarly = false;
        //            }
        //        }
        //    }
        //    return model;
        //}


        ///// <summary>
        ///// 获得前几行数据
        ///// </summary>
        //public DataSet GetList(int Top, string strWhere, string filedOrder)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select ");
        //    if (Top > 0)
        //    {
        //        strSql.Append(" top " + Top.ToString());
        //    }
        //    strSql.Append(" supplyPlanId,purchaseid,proid,projectId,bidid,usework,supplyDate,mbm,material,num,unit,unitPrice,technicalDataStatus,technicalDataStatusDate,supplyDateStatus,supplyDateStatusDate,arrivalCount,contractdate,complateDate,fristCheckedCount,instoreCount,arrivalBillStatus,arrivalEvaluationStatus,arrivalEvaluationStatusDate,outstoreCount,installationStatus,installationStatusDate,putOperationStatus,putOperationStatusDate,putOperationEvaluationStaus,putOperationEvaluationStausDate,warrantyStatus,warrantyStatusDate,winBid,warrantyEvaluationStaus,warrantyEvaluationStausDate,sourceProid,sourceProjectId,sourceProjectName,equipmentManage,sid,sname,slink,slinkContent,confirmDateWarn,wasteCount,realSupplyDate,warrantyTime,settlementTimeWarn,coordinate,deviceproductionstate,remark,user_id,supplyPlanType,isEarly ");
        //    strSql.Append(" FROM supplyPlan ");
        //    if (strWhere.Trim() != "")
        //    {
        //        strSql.Append(" where " + strWhere);
        //    }
        //    strSql.Append(" order by " + filedOrder);
        //    return DbHelperSQL.Query(strSql.ToString());
        //}

        ///// <summary>
        ///// 获取记录总数
        ///// </summary>
        //public int GetRecordCount(string strWhere)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("select count(1) FROM supplyPlan ");
        //    if (strWhere.Trim() != "")
        //    {
        //        strSql.Append(" where " + strWhere);
        //    }
        //    object obj = DbHelperSQL.GetSingle(strSql.ToString());
        //    if (obj == null)
        //    {
        //        return 0;
        //    }
        //    else
        //    {
        //        return Convert.ToInt32(obj);
        //    }
        //}
        ///// <summary>
        ///// 分页获取数据列表
        ///// </summary>
        //public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append("SELECT * FROM ( ");
        //    strSql.Append(" SELECT ROW_NUMBER() OVER (");
        //    if (!string.IsNullOrEmpty(orderby.Trim()))
        //    {
        //        strSql.Append("order by T." + orderby);
        //    }
        //    else
        //    {
        //        strSql.Append("order by T.supplyPlanId desc");
        //    }
        //    strSql.Append(")AS Row, T.*  from supplyPlan T ");
        //    if (!string.IsNullOrEmpty(strWhere.Trim()))
        //    {
        //        strSql.Append(" WHERE " + strWhere);
        //    }
        //    strSql.Append(" ) TT");
        //    strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
        //    return DbHelperSQL.Query(strSql.ToString());
        //}

        ///*
        ///// <summary>
        ///// 分页获取数据列表
        ///// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@tblName", SqlDbType.VarChar, 255),
        //            new SqlParameter("@fldName", SqlDbType.VarChar, 255),
        //            new SqlParameter("@PageSize", SqlDbType.Int),
        //            new SqlParameter("@PageIndex", SqlDbType.Int),
        //            new SqlParameter("@IsReCount", SqlDbType.Bit),
        //            new SqlParameter("@OrderType", SqlDbType.Bit),
        //            new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
        //            };
        //    parameters[0].Value = "supplyPlan";
        //    parameters[1].Value = "supplyPlanId";
        //    parameters[2].Value = PageSize;
        //    parameters[3].Value = PageIndex;
        //    parameters[4].Value = 0;
        //    parameters[5].Value = 0;
        //    parameters[6].Value = strWhere;	
        //    return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        //}*/

        #endregion  BasicMethod

        

      
	}
}

